package com.example.lib_net.interceptor

import android.os.Build
import com.example.lib_storage.mmkv.AppMMKV
import com.example.lib_storage.mmkv.AuthMMKV
import okhttp3.Interceptor
import okhttp3.Request
import okhttp3.Response


class HttpHeaderInterceptor:Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val original = chain.request()
         val meid: String = AppMMKV.meid
        val requestBuilder = original.newBuilder()
            .addHeader("Content-Language", "")//BuildConfig.I18N_LANG
            .addHeader("platform", "ANDROID")
            .addHeader("source", "CLUB_APP")
            .addHeader("Authorization", AuthMMKV.token)
            .addHeader("meid", meid ?: "")
            .addHeader("version", "1.0.0")//BuildConfig.VERSION_NAME
            .addHeader("phoneModel", Build.BRAND + "_" + Build.MODEL)
        val request: Request = requestBuilder.build()
        return chain.proceed(request)
    }
}